package com.example.xd.Builder;

import com.example.xd.Entity.NavigationItem;
import com.example.xd.Entity.VideoClassifyItem;
import com.example.xd.Util.jwtUtil;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


public class ItemListBuilder {

    @Resource
    private jwtUtil jwtUtil;

    public List<NavigationItem> buildNavigation(String authorization) {
        List<NavigationItem> list = new ArrayList<NavigationItem>();
        list.add(new NavigationItem("/", "首页"));
        list.add(new NavigationItem("/Drama", "番剧"));
        list.add(new NavigationItem("/games", "游戏"));
        list.add(new NavigationItem("/music", "音乐"));
        if (authorization != null && authorization.startsWith("Bearer ")) {
            String token = authorization.substring(7);
            if (jwtUtil.validateToken(token)) {
                list.add(new NavigationItem("/Personal Center", "个人中心"));
                list.add(new NavigationItem("/getImage", "头像"));
                list.add(new NavigationItem("/getImage", "消息"));
                list.add(new NavigationItem("/getImage", "会员"));
                list.add(new NavigationItem("/getImage", "历史"));
                list.add(new NavigationItem("/getImage", "收藏"));
                list.add(new NavigationItem("/getImage", "投稿"));
            }
        }
        return list;
    }

    public List<VideoClassifyItem> buildVideoClassify() {
        List<VideoClassifyItem> items = new ArrayList<VideoClassifyItem>();
        items.add(new VideoClassifyItem("/Drama", "番剧"));
        items.add(new VideoClassifyItem("/games", "游戏"));
        items.add(new VideoClassifyItem("/music", "音乐"));
        items.add(new VideoClassifyItem("/Drama", "番剧"));
        items.add(new VideoClassifyItem("/games", "游戏"));
        items.add(new VideoClassifyItem("/music", "音乐"));
        items.add(new VideoClassifyItem("/Drama", "番剧"));
        items.add(new VideoClassifyItem("/games", "游戏"));
        items.add(new VideoClassifyItem("/music", "音乐"));
        items.add(new VideoClassifyItem("/Drama", "番剧"));
        items.add(new VideoClassifyItem("/games", "游戏"));
        items.add(new VideoClassifyItem("/music", "音乐"));
        return items;
    }

    public List<VideoClassifyItem> buildVideoClassifyItem() {
        List<VideoClassifyItem> items = new ArrayList<>();
        items.add(new VideoClassifyItem("/hotNum", "热门番剧"));
        return items;
    }

}
